home *** CD-ROM | disk | FTP | other *** search
/ Windows 95 API Bible / Windows 95 API Bible 3 Disc Set.iso / Win32 API Bible Book 1 of 3 / CHAPTE21 / EX11.C < prev    next >
C/C++ Source or Header  |  1995-05-29  |  2KB  |  50 lines

  1. #include <genstub.c>
  2.  
  3. LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
  4. {
  5.  
  6.    switch (uMsg)
  7.    {
  8.          case WM_COMMAND:
  9.                switch ( LOWORD( wParam ) )
  10.                {
  11.                      case IDM_TEST:
  12.                      {
  13.                            SYSTEM_INFO si;
  14.                            char        szBuffer[128];
  15.                            HDC         hDC = GetDC( hWnd );
  16.  
  17.                            GetSystemInfo( &si );
  18.                            // Report system info.
  19.                            wsprintf( szBuffer, "OEM Id: %X, Addr Range %lX-%lX",
  20.                                      si.dwOemId, si.lpMinimumApplicationAddress,
  21.                                      si.lpMaximumApplicationAddress);
  22.                            TextOut( hDC, 0, 0, szBuffer, lstrlen(szBuffer ) );
  23.                            wsprintf( szBuffer, "Page Size: %lX, Allocation: %lX",
  24.                                      si.dwPageSize, si.dwAllocationGranularity );
  25.                            TextOut( hDC, 0, 20, szBuffer, lstrlen(szBuffer ) );
  26.                            // Just test for Intel x86 chips. Windows 95 does not run
  27.                            // on the RISC-based architectures.
  28.                            wsprintf( szBuffer, "Type of Processor: %s",
  29.                                    ( si.dwProcessorType == PROCESSOR_INTEL_386 ) ?
  30.                                    "386" :
  31.                                    ( ( si.dwProcessorType == PROCESSOR_INTEL_486 ) ?
  32.                                    "486" : "PENTIUM" ) );
  33.                            TextOut( hDC, 0, 40, szBuffer, lstrlen(szBuffer ) );
  34.                            ReleaseDC( hWnd, hDC );
  35.                            return 0;
  36.                      }
  37.                      break;
  38.                      case IDM_EXIT:
  39.                            DestroyWindow( hWnd );
  40.                            break;
  41.                }
  42.                break;
  43.                case WM_DESTROY:
  44.                      PostQuitMessage( 0 );
  45.                break;
  46.          default:
  47.                return (DefWindowProc(hWnd, uMsg, wParam, lParam));
  48.    }
  49.    return (NULL);
  50. }